import axios, { $REQUEST_URL } from '@/request';
// 请求地址
const URL = $REQUEST_URL;
window.console.log('$REQUEST_URL -- 请求地址', $REQUEST_URL);
// 工作量化请求地址前缀
const QUANT_URL_PREFIX = 'sepa/taskQuantization';
// 无线报警请求地址前缀
const WIRELESS_URL_PREFIX = 'sepa/alarmdata';

// 封装使用@requestparams注解的post方法
function requestPost(url, params) {
    return axios({
        method: 'POST',
        url,
        params,
    });
}

/** *************** 工作量化 ****************** */
/** 请求人员 */
export const getUsers = (params) => requestPost(`${URL}${QUANT_URL_PREFIX}/userList`, params);

/** 请求组织 */
export const getOrgs = () => requestPost(`${URL}${QUANT_URL_PREFIX}/oraList`);

/** 按照人员统计查询列表 */
export const getList = (params) => requestPost(`${URL}${QUANT_URL_PREFIX}/taskQuantizationList`, params);

/** 按照任务统计点击查看任务详情 */
export const getTaskInfo = (params) => requestPost(`${URL}${QUANT_URL_PREFIX}/queryList`, params);

/** 按照任务统计任务新增修改 */
export const createNewTask = (params) => requestPost(`${URL}${QUANT_URL_PREFIX}/save`, params);

/** 按照任务统计任务删除 */
export const removeTask = (params) => requestPost(`${URL}${QUANT_URL_PREFIX}/delete`, params);

/** 数据字典 */
export const getDict = () => requestPost(`${URL}${QUANT_URL_PREFIX}/dicData`);

/** *************** 无线报警 ****************** */
/** 无线报警查询列表 */
export const getWarnList = (params) => requestPost(`${URL}${WIRELESS_URL_PREFIX}/list`, params);

/** *************** 首页 ****************** */
/** 故障超限指标统计 */
export const getFaultLimitData = () => axios.get(`${URL}dp/ams/fault/timeout/luju`);

/** 故障超限详情 */
export const getLimitInfoData = (params) => axios.post(`${URL}/dp/ams/unusualTrackDatalist`, params);

/** 备品数量 */
export const getBpNums = () => requestPost(`${URL}sepa/dataCockpit/bptjByOrgan`);

/** 备品统计 */
export const getBpStatic = () => requestPost(`${URL}sepa/dataCockpit/bptjByUnite`);

/** 重点任务列表 */
export const getBreakTaskList = () => axios.get(`${URL}dp/zdrw/zdrwList`);

/** 重点任务详情 */
export const getBreakTaskInfoData = (params) => axios.get(`${URL}dp/zdrw/task/list`, { params });

/** 工作量化追踪 */
export const getQuants = () => requestPost(`${URL}sepa/dataCockpit/taskQuantizationTj`);

/** 无线超时统计 */
export const getWirelessData = () => requestPost(`${URL}sepa/dataCockpit/wxAlarmTj`);

/** 列表 */
export const getTrainList = () => axios.get(`${URL}dp/ams/luju/summary`);

/** 无线报警统计 */
export const getWirelessWarnData = () => requestPost(`${URL}sepa/dataCockpit/wxbjTjList`);

/** 加装改造设备统计 */
export const getDeviceStatic = () => axios.get(`${URL}dp/trainjzgz/statisticBySb`);

// 驾驶舱
/** 故障件分布 */
export const getFaultDistribute = () => axios.get(`${URL}dp/ams/statistic/fault/atpalarm/luju`);

/** 当日故障 */
export const getDayFault = () => axios.get(`${URL}dp/ams/luju/dayfault/statistic/bystatus`);

/** 机检比例 */
export const getAutoCheck = () => axios.get(`${URL}dp/yjx/statistic/luju/cdxs`);

/** 年度故障统计 */
export const getYearFaultStatic = () => axios.get(`${URL}dp/ams/statistic/fault/atpalarm/dwd/count`);

/** *************** 页面跳转请求 ****************** */
/** 页面跳转请求 */
export const changePageRoute = (id) => `${URL}sepa/dataCockpit/index?permissionId=${id}`;

/** *************** 无线超时 ****************** */
/** 无线超时 */
export const getTimeoutList = (params) => axios.get(`${URL}dp/c3/degrade/list`, { params });

/** 无线超时详情 */
export const getTimeoutDetailList = (params) => axios.get(`${URL}dp/c3/degrade/detail/list`, { params });
